-
Notifications
You must be signed in to change notification settings - Fork 369
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Deploy an oracle cronjob #1814
Deploy an oracle cronjob #1814
Conversation
.env
Outdated
@@ -32,6 +32,12 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="master" | |||
CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" | |||
CELOTOOL_DOCKER_IMAGE_TAG="celotool-dfdc3e8b26e98aa294b27e2b5621c184488a10db" | |||
|
|||
CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" | |||
# TODO (yerdua): Change this to something actually reasonable | |||
CELOCLI_STANDALONE_IMAGE_TAG="yerduaoracletest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This really doesn't seem ideal. I needed a docker image that can run the cli. The existing dockerfile has deeply hardcoded references to alfajores and runs a full node. In order to get something here, I built an image and pushed it manually.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add both env vars to all .env files?
There's a few incomplete things in this PR. The primary one is the handling of the docker image for Also, there is no default oracle process. There's a docker image in a private repo, for my testnet, and for baklava. In an ideal world, there should probably be some default image, maybe just spitting out the exchange rate value specified in the config. Given the tight deadline, I think it's ok if the command fails when there's no oracle image for now. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Couple small changes pending the new cli version
packages/celotool/src/lib/oracle.ts
Outdated
|
||
function helmParameters(celoEnv: string) { | ||
return [ | ||
`--set celotool.image.repository=${fetchEnv('CELOTOOL_DOCKER_IMAGE_REPOSITORY')}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: some of these string literals are already found in envVar
, if they aren't we should add them and use them to avoid hardcoding strings
packages/celotool/src/lib/oracle.ts
Outdated
`--set celotool.image.repository=${fetchEnv('CELOTOOL_DOCKER_IMAGE_REPOSITORY')}`, | ||
`--set celotool.image.tag=${fetchEnv('CELOTOOL_DOCKER_IMAGE_TAG')}`, | ||
`--set mnemonic="${fetchEnv(envVar.MNEMONIC)}"`, | ||
`--set oracle.image.repository=${fetchEnv('ORACLE_DOCKER_IMAGE_REPOSITORY')}`, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is this used? same goes for any use of ORACLE_DOCKER_IMAGE_REPOSITORY
.env
Outdated
@@ -32,6 +32,12 @@ GETH_BOOTNODE_DOCKER_IMAGE_TAG="master" | |||
CELOTOOL_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/celo-monorepo" | |||
CELOTOOL_DOCKER_IMAGE_TAG="celotool-dfdc3e8b26e98aa294b27e2b5621c184488a10db" | |||
|
|||
CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" | |||
# TODO (yerdua): Change this to something actually reasonable | |||
CELOCLI_STANDALONE_IMAGE_TAG="yerduaoracletest" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you add both env vars to all .env files?
spec: | ||
initContainers: | ||
- name: get-current-price | ||
image: gcr.io/celo-testnet/oracle:{{ .Release.Namespace }} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah I think I get it now- should we set the repository and tag here similar to what we do for geth or celotool by having it depend on .env variables?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oops! Thank you! This is where those unused envVars were supposed to go.
nodeSelector: {} | ||
|
||
# Expects cron schedule syntax | ||
oracleSchedule: "*/1 * * * *" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
might be helpful to add a comment what this schedule means in readable terms for people like myself that never remember the cron schedule structure
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Excellent idea. I had to look it up myself.
Do you think this makes sense here, or should it be an envVar like all the other ones?
Codecov Report
@@ Coverage Diff @@
## master #1814 +/- ##
=========================================
Coverage ? 74.45%
=========================================
Files ? 281
Lines ? 7817
Branches ? 973
=========================================
Hits ? 5820
Misses ? 1880
Partials ? 117
Continue to review full report at Codecov.
|
Note: This branch has |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Suggest adding a note at the top of the PR description that Trevor's branch changes must merge first before this :)
…lotool deployment command for the oracle
60f0540
to
75d9681
Compare
CELOCLI_STANDALONE_IMAGE_REPOSITORY="gcr.io/celo-testnet/celocli-standalone" | ||
CELOCLI_STANDALONE_IMAGE_TAG="0.0.30-beta2" | ||
|
||
# Schedule for an oracle deployed via celotool, expressed in crontab syntax | ||
# This schedule is "every 5th minute" | ||
ORACLE_CRON_SCHEDULE="*/5 * * * *" | ||
|
||
ORACLE_DOCKER_IMAGE_REPOSITORY="gcr.io/celo-testnet/oracle" | ||
ORACLE_DOCKER_IMAGE_TAG="baklavastaging" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The origin of this file is @tkporter's branch for baklavastaging deployment, as it is today (Dec 2). These vars are the only ones I added:
CELOCLI_STANDALONE_IMAGE_REPOSITORY
CELOCLI_STANDALONE_IMAGE_TAG
ORACLE_CRON_SCHEDULE
ORACLE_DOCKER_IMAGE_REPOSITORY
ORACLE_DOCKER_IMAGE_TAG
So, if there are merge conflicts in this file that do not involve these variables, the resolution is to pick whatever the other branch has.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The only one of these that should be different for baklava
is:
ORACLE_DOCKER_IMAGE_TAG="baklava"
That docker image already exists and is ready to go.
@@ -46,7 +47,7 @@ module.exports = deploymentForCoreContract<StableTokenInstance>( | |||
|
|||
for (const oracle of config.stableToken.oracles) { | |||
console.info(`Adding ${oracle} as an Oracle for StableToken`) | |||
await sortedOracles.addOracle(stableToken.address, oracle) | |||
await sortedOracles.addOracle(stableToken.address, ensureHexLeader(oracle)) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Without the 0x
, the oracle silently doesn't get whitelisted correctly. This needs to be merged before baklava
deployment.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Super minor comments, nice!
export const builder = {} | ||
|
||
export const handler = async (argv: DestroyArgv) => { | ||
await createClusterIfNotExists() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You should be able to remove this line to decrease the run time-- if we're destroying we should assume that the cluster exists & if it doesn't there's no need in creating it
- sh | ||
- "-c" | ||
- | | ||
echo `./current_rate.sh` > /celo/.celo/current_price |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: should be able to just run ./current_rate.sh > /celo/.celo/current_price
right?
* master: Update docker image and instructions (#2000) DOCS correct typos (#1965) Add a space on payment request (#1935) expose signer through getValidator (#1997) Fix validator election migration bug with sorted list insertion (#1998) Deploy an oracle cronjob (#1814) Set default env in attestation service docker image as production (#1999) Attestation Bot POC (#1851) Only allow external RPCs for tx nodes (#1994)
* master: (120 commits) Update docker image and instructions (#2000) DOCS correct typos (#1965) Add a space on payment request (#1935) expose signer through getValidator (#1997) Fix validator election migration bug with sorted list insertion (#1998) Deploy an oracle cronjob (#1814) Set default env in attestation service docker image as production (#1999) Attestation Bot POC (#1851) Only allow external RPCs for tx nodes (#1994) Specify web deps properly (#1950) Fix error calculating fees on currencies with high exchange rate (#1937) Small pre-stake-off CLI cleanup (#1953) Migrations: different CLabs groups gets different votes (#1960) [Wallet] Fix broken translation (decline, pay) (#1968) [Wallet]: Add Payments You've Requested notifications group & screen (#1902) [Wallet] Fix iOS bundle script failing with our monorepo setup (#1958) [NotificationService] Change exchange rate stored format (number timestamp and pair) (#1945) [Wallet] Fix premature hiding of syncing banner and increase some timeouts (#1957) Avoid `liner: function not supported in this terminal` (#1955) Support more human readable log output (#1929) ...
Description
Helm chart and celotool command to deploy an oracle cronjob to a network.
Note: In order to get this working for
baklavastaging
, I merged in @tkporter's branch trevor/baklavastaging-nov-21. So, that branch should be merged into master first. Or this one should be merged into that one instead.Tested
Tested by running the celotool command to deploy an oracle to
baklavastaging
, and confirming that the rates are reported to the network correctly.Other Changes
Update contractkit's version to accurately reflect what's been published on npm
Related issues